#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#include<stdlib.h>

void Del_Spec_Num()
{
	int N = 0;
	scanf("%d", &N);
	int* arr = (int*)malloc(N * sizeof(int));
	if (arr != NULL)
	{
		int i = 0;
		for (i = 0; i < N; i++)
		{
			scanf("%d", &arr[i]);
		}
		int Del_num = 0;
		scanf("%d", &Del_num);
		for (i = 0; i < N; i++)
		{
			if (Del_num == arr[i])
			{
				arr[i] = -1;
			}
			if (arr[i] > 0)
			{
				printf("%d ", arr[i]);
			}
		}
		printf("\n");
	}
	else
	{
		perror("malloc");
		return 1;
	}
	free(arr);
	arr = NULL;
}

int main()
{
	Del_Spec_Num();
	return 0;
}